package com.fulu.jvm;

/**
 * 可见性测试
 */
class Flag {
    static boolean stop = false;

    public static void main(String[] args) {
        new Thread(() -> {
            while (!stop) {
                // do something
            }
        }).start();

        try { Thread.sleep(1000); } catch (InterruptedException e) {}
        stop = true;
    }
}
